<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>props</title>
</head>

<body>
    <h1>props</h1>
    <p>使用props可以完成父组件向子组件传值</p>
    <div id="app"></div>

    <script src="../node_modules/react/umd/react.development.js"></script>
    <script src="../node_modules/react-dom/umd/react-dom.development.js"></script>
    <script src="../node_modules/babel-standalone/babel.min.js"></script>
    <script type="text/babel">

        function MyCom(props) {
            return (
                <p>{props.title}:{props.work}</p>
            )
        }

        const object = {
            title: "王珂",
            work: "兽医",
        }

        const title = "陈仁杰";
        const work = "售前工程师";

        const app = document.querySelector("#app");
        const root = ReactDOM.createRoot(app);

        const dom = (
            <div>
                <MyCom title="曾颖萍" work='前端工程师'/>
                <MyCom title="奉先" work="后端工程师"/>
                {/* 对象解构进行属性传参 */}
                <MyCom {...object}/>
                {/* 动态绑定标签属性，不要加双引号*/}
                <MyCom title={title} work={work}/>

            </div>)

        root.render(dom);
    </script>
</body>

</html>